package com.etc.dingdan.service.impl;

import com.etc.core.service.ServiceException;
import com.etc.dingdan.dao.DingDanMapper;
import com.etc.dingdan.service.DingDanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class DingDanServiceImp implements DingDanService {

    @Autowired
    DingDanMapper mapper;

    @Transactional(rollbackFor = Exception.class)
    @Override
    public void insertDingdan(Integer id) throws ServiceException {

        int r = mapper.insertDingdan(id, "tom");
        if (r != 1) {
            throw new ServiceException("插入失败");
        }

    }
}
